﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Microsoft.Xna.Framework;

namespace MaterialEditor
{
    public interface IAction
    {
        void Undo();

        void Redo();
    }

    public class AddNodeAction : IAction
    {
        private Node node;

        public AddNodeAction(Node node)
        {
            this.node = node;
        }

        public void Undo()
        {
            Form1.instance.viewWindow1.nodes.Remove(node);
        }

        public void Redo()
        {
            Form1.instance.viewWindow1.nodes.Add(node);
        }
    }

    public class RemoveNodeAction : IAction
    {
        private Node node;

        public RemoveNodeAction(Node node)
        {
            this.node = node;
        }

        public void Undo()
        {
            Form1.instance.viewWindow1.nodes.Add(node);
        }

        public void Redo()
        {
            Form1.instance.viewWindow1.nodes.Remove(node);
        }
    }

    public class ConnectNode : IAction
    {
        NodeConnector c;

        public ConnectNode(NodeConnector c)
        {
            this.c = c;
        }

        public void Undo()
        {
            Form1.instance.viewWindow1.nodeConnectors.Remove(c);
        }

        public void Redo()
        {
            Form1.instance.viewWindow1.nodeConnectors.Add(c);
        }
    }
}
